package com.ffws.content.api;

import com.ffws.base.model.RestResponse;
import com.ffws.content.model.po.FireInformation;
import com.ffws.content.model.po.MainTab;
import com.ffws.content.model.po.NewCondition;
import com.ffws.content.service.MainContentService;
import com.ffws.feign.po.Person;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author JC
 * @description 主页面内容
 * @Date 2023-8-29 18:44
 * @Version 1.0
 */
@RestController
@Api(value = "主页面内容的接口", tags = "主页面内容的接口")
public class MainContentController {

    @Autowired
    MainContentService mainContentService;

    @ApiOperation(value = "得到所有地区标签")
    @GetMapping("/main/getMainTab")
    public RestResponse<List<MainTab>> getMainTab() {
        return mainContentService.getMainTab();
    }

    @ApiOperation(value = "得到该标签下的所有成员")
    @GetMapping("/main/getPersonList")
    public RestResponse<List<Person>> getPersonList(@RequestParam("tabId") @ApiParam("标签id") Long tabId) {
        return mainContentService.getPersonList(tabId);
    }

    @ApiOperation(value = "得到该标签下的火灾重要信息")
    @GetMapping("/main/getFireInfo")
    public RestResponse<FireInformation> getFireInfo(@RequestParam("tabId") @ApiParam("标签id") Long tabId) {
        return mainContentService.getFireInfo(tabId);
    }

    @ApiOperation(value = "得到最新消息")
    @GetMapping("/main/getNewCondition")
    public RestResponse<NewCondition> getNewCondition(@RequestParam("tabId") @ApiParam("标签id") Long tabId) {
        return mainContentService.getNewCondition(tabId);
    }

    @ApiOperation(value = "通过id得到成员信息")
    @GetMapping("/person/{id}")
    public Person getPersonById(@PathVariable Long id) {
        return mainContentService.getPersonById(id);
    }

}
